<%/* I (David P Shenba) licenses this file to you under the Apache License, 
 * Version 2.0 (the "License"); you may not use this 
 * file except in compliance with the License.  You may 
 * obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */ %>
<%@ page contentType="text/html; charset=utf-8" %>

<%@ taglib uri="/WEB-INF/classes/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/classes/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/classes/struts-logic.tld" prefix="logic" %>
<html:html>
<head>
<title>Bean Array Demo</title>
<script type="text/javascript" src="../js/demo.js"></script>
</head>
	<body onload="preparePage();">
		<html:form action="inputScreen?method=displayBeans" method="POST">
		<script>demoBeanSize = <bean:write name="demoForm" property="demoBeansSize"/>;</script>
		<div id="beanArryContent">
		<logic:iterate name="demoForm" property="demoBeans" id="demoBean" indexId="beanCount">
		<div id='bean<%=beanCount%>Content'>
		<b>Bean <%=beanCount+1%>:</b>
			 <button type="button" id='bean<%=beanCount%>Button' onclick="removeBeanContent('<%=beanCount%>');" disabled="disabled">Remove</button> <br/>
		<table>
			<tr>
				<td>Name</td>
				<td>:</td>
				<td><html:text name="demoBean" property="name" indexed="true" /></td>
			</tr>
			<tr>
				<td>Age</td>
				<td>:</td>
				<td><html:text name="demoBean" property="age" indexed="true" /></td>
			</tr>
			<tr>
				<td>Sex</td>
				<td>:</td>
				<td><html:radio name="demoBean" property="sex"
					indexed="true" value="Male" /> Male <html:radio name="demoBean"
					property="sex" indexed="true" value="Female" /> Female</td>
			</tr>
			<tr>
				<td>Relationship Status</td>
				<td>:</td>
				<td><html:select name="demoBean" property="married"
					indexed="true">
					<html:option value="Single">Single</html:option>
					<html:option value="Married">Married</html:option>
					<html:option value="Divorced">Divorced</html:option>
					<html:option value="Widowed">Widowed</html:option>
				</html:select></td>
			</tr>
		</table>
		<hr/>
		</div>
	</logic:iterate>
	</div>
    <center><button type="button" name="add" onclick="addBeanSection();">Add</button> <html:submit>submit</html:submit></center>
	</html:form>
	</body>
</html:html>